package com.rc.saas.mini.controller.tenant;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.base.MinipBaseController;
import com.rc.saas.mini.common.base.DataTResponse;
import com.rc.saas.mini.common.base.TResponse;
import com.rc.saas.mini.common.constant.SessionConstants;
import com.rc.saas.mini.mapper.tenant.TenantTransferMapper;
import com.rc.saas.mini.minip.vo.LoginInfoVo;
import com.rc.saas.mini.model.tenant.TenantTransfer;
import com.rc.saas.mini.model.tenant.TenantTransferExample;
import com.rc.saas.mini.service.tenant.TenantTransferService;
import com.rc.saas.mini.service.tenant.TenantTransferServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @Description 
 * @Author  
 * @Date: 2022-07-19
 */

@Api(tags = "用户余额提现功能设置mvc鍔熻兘")
@Controller
@RequestMapping("/tenantTransfer")
public class TenantTransferController extends MinipBaseController {

    private static Logger logger = LogManager.getLogger(TenantTransferController.class);

    @Autowired
    private TenantTransferService tenantTransferService;



    /**
     * 用户余额提现功能设置
     */
    @ApiOperation(value="用户余额提现功能设置", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @RequestMapping(value = "/open/selectByTransferId", method = RequestMethod.POST)
    @ResponseBody
    private DataTResponse<TenantTransfer> selectByTransferId(HttpServletRequest request) {
        String tenantCode = (String) request.getSession().getAttribute(SessionConstants.SESSION_TENANT);
        if (tenantCode == null || StringUtils.isBlank(tenantCode)) {
            logger.error("找不到对应运营商信息:{}", tenantCode);
            return DataTResponse.FAIL("找不到对应运营商信息");
        }
        TenantTransfer tenantTransfer=tenantTransferService.selectByTenantCode(tenantCode);

        return DataTResponse.SUCCESS_DATA(tenantTransfer);
    }


}
